const express = require('express');

const app = express();
// 设置CORS跨域
app.use((request, response, next)=>{
    response.setHeader('Access-Control-Allow-Origin','*');
    response.setHeader('Access-Control-Allow-Headers','*');
    next();
})

// 请求的路径
app.get('/json', (request, response)=>{
    response.json({
        code:1,
        msg:'成功'
    })
})

app.listen(8000,()=>{
    console.log('server run at 8000');
})